package com.hpq.user.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * 存储场景枚举
 */
@Getter
@AllArgsConstructor
public enum OssSceneEnum {
    CHAT(1,"聊天","/chat"),
    EMOJI(2,"表情","/emoji");
    private final Integer code;
    private final String desc;
    private final String path;
    private static Map<Integer,OssSceneEnum> cache;
    static{
        cache = Arrays.stream(OssSceneEnum.values()).collect(Collectors.toMap(OssSceneEnum::getCode, Function.identity()));
    }
   public static OssSceneEnum of(Integer code){
        return cache.get(code);
   }
}
